Skip to content

fix(installer): resolve PowerShell 5.1 compatibility and restore uninstall.ps1#158

Open
muhammadGagah wants to merge 1 commit into
Community-Access:mainfrom
muhammadGagah:fix/powershell-install-uninstall
Open

fix(installer): resolve PowerShell 5.1 compatibility and restore uninstall.ps1#158
muhammadGagah wants to merge 1 commit into
Community-Access:mainfrom
muhammadGagah:fix/powershell-install-uninstall

Conversation

@muhammadGagah

Copy link
Copy Markdown

Description

This PR addresses two critical installation and maintenance issues on Windows environments running classic Windows PowerShell 5.1 (the default pre-installed shell on Windows 10 and 11):

  1. PowerShell 5.1 Join-Path positional parameter crash in install.ps1.
  2. Broken uninstall command resulting in 404 errors due to the deletion of the legacy uninstaller script while still referencing it in the installer output and readme. We have restored and hardened uninstall.ps1 to resolve this.

Changes Made

1. Fix Join-Path positional arguments in install.ps1

  • Problem: In classic Windows PowerShell 5.1, Join-Path only supports joining up to two path segments (Path and ChildPath). Passing additional positional arguments (e.g. Join-Path $WorkingDir "node_modules" $ModuleName "package.json") throws a terminating PositionalParameterNotFound exception.
  • Solution: Modified the call in Test-NodeModuleAvailable to join the child paths into a single interpolated string:
    $ModulePkgPath = Join-Path $WorkingDir "node_modules\$ModuleName\package.json"
    This is fully backward-compatible with PowerShell 5.1 and forward-compatible with PowerShell Core 6+.

2. Restore and Harden uninstall.ps1

  • Problem: The uninstaller script was previously deleted from the repository during the migration to the gh skill flow. However, the install.ps1 success message and README.md still instruct users to run:
    irm https://raw.githubusercontent.com/Community-Access/accessibility-agents/main/uninstall.ps1 | iex
    This command fails with a 404 error, leaving users who used the manual installer with no automated way to cleanly remove global configurations, agents, Codex files, Gemini extensions, and the MCP server.
  • Solution: We restored uninstall.ps1 from the repository history and hardened it:
    • Auto-Kill Server Process: Added a Stop-RunningMcpProcesses helper that uses WMI (Get-CimInstance Win32_Process) to safely query and terminate any active node.exe processes running server.js from the target MCP installation directories. This prevents the Remove-Item file-lock exception that previously occurred if the MCP server was running.
    • Graceful Lock Handling: Wrapped the Remove-Item directory deletions in try/catch blocks. If folders remain locked by other applications (e.g. an open File Explorer window or a terminal set to that directory), the script now prints a clear instruction asking the user to close those programs, rather than crashing with a raw PowerShell stack trace.

Why the Uninstaller Script Should Be Kept

While the project is standardizing on the new gh skill command structure, keeping the standalone uninstall.ps1 (and uninstall.sh) is still necessary for the following reasons:

  • Compatibility with Legacy Installations: Users who installed accessibility-agents prior to the gh skill transition or those who run the manual script (install.ps1) need a corresponding uninstaller to clean up files.
  • Limitations in Preview CLI: The gh skill command group is currently in preview, and some versions do not contain an uninstall or remove subcommand, leaving manual cleanup as the only recourse.
  • Safety Net: A dedicated script ensures that files copied into user directories (~/.claude/, ~/.codex/, ~/.gemini/, and ~/.a11y-agent-team/) can be cleared out reliably without forcing the user to find and delete directories manually.

Recommendations for Further Review

The following areas are recommended for developer review and are not included in this PR:

1. Fix gh skill Subcommand Assumptions

The documentation in UNINSTALL.md and docs/GH-SKILL-MIGRATION.md references the command gh skill uninstall. However, the current GitHub CLI gh skill subcommand set only contains install, list, preview, publish, search, and update (no uninstall or remove exists). The development team should either:

  • Propose the addition of uninstall to the upstream gh-skill CLI extension.
  • Or update the documentation to instruct users to run gh extension remove gh-skill or manual directory cleanup.

2. Update Installer Output and Documentation

If the team still intends to deprecate standalone uninstaller scripts:

  • Remove the irm ... uninstall.ps1 | iex command printout from the success screen of install.ps1.
  • Update README.md and UNINSTALL.md to remove dead script links.

3. Review Bash Scripts (install.sh and uninstall.sh)

  • Path Joining: Ensure the Bash scripts do not make assumptions about directory structures that could fail on custom macOS or Linux environments.
  • Process Locking: Implement a process detection and stop mechanism (using lsof or fuser equivalent) in uninstall.sh to prevent similar file-lock errors when removing the global MCP server folder on macOS/Linux.
    Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant